package com.standardoperationapp.net;


import android.content.Context;

import java.util.HashMap;

import io.reactivex.Observable;
import io.reactivex.observers.DisposableObserver;
import okhttp3.ResponseBody;
public class BaseSubscribe {
    public static void getCAPTCHA(Context context,  DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getCAPTCHA();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getLogin(Context context, HashMap hashMap, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getLogin(hashMap);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    public static void getLockOpenList(Context context, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getLockOpenList();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void checkLockEmpower(Context context,String id, DisposableObserver<ResponseBody> subscriber){
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().checkLockEmpower(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);

    }

    public static void getMyAccessDoor(Context context, DisposableObserver<ResponseBody> subscriber){
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMyAccessDoor();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);

    }
    public static void getLockOpenKey(Context context,HashMap hashMap, DisposableObserver<ResponseBody> subscriber){
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getLockOpenKey(hashMap);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);

    }

    public static void chekUnlockNum(Context context,String id,String randomNumber, DisposableObserver<ResponseBody> subscriber){
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().chekUnlockNum(id,randomNumber);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    public static void getLockOpen(Context context,String id,HashMap hashMap,DisposableObserver<ResponseBody> subscriber){
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getLockOpen(id,hashMap);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getEmergentLockOpen(Context context,String token,HashMap hashMap,DisposableObserver<ResponseBody> subscriber){
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getEmergentLockOpen(token,hashMap);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getDropList(Context context, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getDropList();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getBluetoothLock(Context context,String mac,String status,String remark,String battery,  DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getBluetoothLock(mac,status,remark,battery);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

}
